package cinvestment;

import java.util.List;

import util.Lang;

/**
 * Maintain the pr0ducts(index) it can produce. And its capacity
 * **/
public class Plant {

	private List<Integer> availableProducts;
	private double capacity;
	private int indicator;// 0 represents the plant has no capacity investment,
							// 1 means that the plant has capacity investment

	public List<Integer> getAvailableProducts() {
		return availableProducts;
	}

	public void setAvailableProducts(List<Integer> availableProducts) {
		this.availableProducts = Lang.clone(availableProducts);
	}

	public double getCapacity() {
		return capacity;
	}

	public void setCapacity(double capacity) {
		this.capacity = capacity;
	}

	public int getIndicator() {
		return indicator;
	}

	public void setIndicator(int indicator) {
		this.indicator = indicator;
	}

	public int getAvailableProductsNumber() {
		if (this.availableProducts == null)
			return 0;
		else
			return this.availableProducts.size();
	}

	/**
	 * Check if plant can product the product
	 * 
	 * @param productIndex
	 *            : index of product needed to check
	 * @return true: if the plant can produce;
	 * **/
	public boolean isAvailable(int productIndex) {
		if (this.availableProducts != null
				&& this.availableProducts.contains(productIndex))
			return true;
		return false;
	}

	public void print() {
		System.out.println("==========");
		Lang.print(Lang.conver2Array(this.availableProducts));
	}
}
